angular.module('invoice', []).controller('invoiceCtrl', [
    '$scope',
    'httpService',
    'alertmsg',
    function($scope, httpService, alertmsg) {
        /* 获取我的发票 start */
        var pagenum = 1;
        $scope.getMyInvoices = function(page) {
            if (page) {
                pagenum = page;
            }
            httpService.query('web/users/'+ user.id +'/fetch_invoices', { page: pagenum, limit: limit}).then(function(res) {
                if (res.code == 200) {
                  console.log(res);
                  $scope.invoices = res.invoices;
                  $scope.page = res.page;
                } else {
                  alertmsg(res.msg);
                }
            });
        }
        $scope.getMyInvoices(1)
        /* 获取我的发票 end */
    }
]);
